home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Triad.dxr / Internal_8_reserve cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.1 KB  |  83 lines

  1. property spriteNum, motion, location, row
  2. global reserve, getlist, equal, currentsel, godlist, foundation, points, tableau
  3.  
  4. on beginSprite me
  5.   row = determinerow()
  6.   location = sprite(spriteNum).loc
  7. end
  8.  
  9. on determinerow me
  10.   if spriteNum = 13 then
  11.     return #rone
  12.   else
  13.     if spriteNum = 14 then
  14.       return #rtwo
  15.     else
  16.       if spriteNum = 15 then
  17.         return #rthree
  18.       end if
  19.     end if
  20.   end if
  21. end
  22.  
  23. on mouseDown me
  24.   if reserve[row].getcardcount() > 0 then
  25.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  26.     sprite(spriteNum).locZ = spriteNum + 1000
  27.     getlist = reserve[row]
  28.     motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  29.   end if
  30. end
  31.  
  32. on moving me
  33.   if the mouseDown then
  34.     sprite(spriteNum).loc = the mouseLoc
  35.   else
  36.     if the mouseUp then
  37.       sprite(spriteNum).locZ = spriteNum
  38.       motion.forget()
  39.       abort()
  40.     end if
  41.   end if
  42. end
  43.  
  44. on mouseUp me
  45.   if equal then
  46.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  47.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  48.     godlist.addCard(currentsel)
  49.     sprite(spriteNum).loc = location
  50.     reserve[row].cards.deleteOne(reserve[row].getlastcard())
  51.     if reserve[row].getcardcount() > 0 then
  52.       sprite(spriteNum).member = member(reserve[row].getlastcard().membername, "playing cards")
  53.     else
  54.       if reserve[row].getcardcount() = 0 then
  55.         sprite(spriteNum).member = member("empty", "playing cards")
  56.       end if
  57.     end if
  58.     equal = 0
  59.     if objectp(foundation[sprite(currentsel).row]) then
  60.       points = points + 10
  61.     end if
  62.     if objectp(tableau[sprite(currentsel).row]) then
  63.       repeat with i = 87 to 90
  64.         if tableau[sprite(i).row].getcardcount() = 0 then
  65.           next repeat
  66.         end if
  67.         sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  68.       end repeat
  69.     end if
  70.     currentsel = 0
  71.     godlist = VOID
  72.     getlist = VOID
  73.     checkwin()
  74.   else
  75.     if not equal then
  76.       puppetSound(3, member("drop card", "100GPak Generic SFX"))
  77.       getlist = VOID
  78.       sprite(spriteNum).loc = location
  79.     end if
  80.   end if
  81.   checkwin()
  82. end
  83.